package main

import "log"

import (
	"github.com/lxn/walk"
	. "github.com/lxn/walk/declarative"
)

var le *walk.LineEdit
var sport *walk.CheckBox

func main() {
	if _, err := MainWindow1.Run(); err != nil {
		log.Fatal(err)
	}
	log.Fatal(Bind("enabledCB.Checked"))
}

var MainWindow1 = MainWindow{
	Title:    "MainWindow",
	Icon:     "boy.ico",
	MinSize:  Size{300, 200},
	Layout:   VBox{},
	Children: widget,
}
var widget = []Widget{
	LineEdit1,
	CheckBoxSport,
	PushButtonOK,
}
var LineEdit1 = LineEdit{
	AssignTo: &le,
}
var CheckBoxSport = CheckBox{
	AssignTo: &sport,
	Text:     "喜欢运动",
	Checked:  true,
}
var PushButtonOK = PushButton{
	Text:      "OK",
	OnClicked: OK_Clicked,
}

func OK_Clicked() {
	if sport.Checked() {
		le.SetText("喜欢运动")
	} else {
		le.SetText("不喜欢运动")
	}
}
